﻿using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text;
//using T.FAS.Authority.Metadata.Entity;
using T.FAS.Runtime.Metadata.Entity.DataModel;

namespace T.FAS.Runtime.Metadata.Entity.Page
{
    [DataContract]
    [Serializable]
    public class PageHeader: ICloneable
    {
        /// <summary>
        /// 主键
        /// </summary>
        [DataMember]
        public string ID { get; set; }
        /// <summary>
        /// 标题
        /// </summary>
        [DataMember]
        public string Title { get; set; }
        /// <summary>
        /// 界面类型
        /// </summary>  
        [DataMember]
        public PageType PageType { get; set; }

        /// <summary>
        /// 客户端类型
        /// </summary>
        [DataMember]
        public ClientType ClientType { get; set; }

        /// <summary>
        /// 是否支持匿名访问
        /// </summary>
        [DataMember]
        public bool IsAnonymous { get; set; }     

        /// <summary>
        /// 界面定位类型
        /// </summary>
        [DataMember]
        public PositionType PositionType { get; set; }

        /// <summary>
        /// 界面样式类
        /// </summary>
        [DataMember]
        public string CustomClass { get; set; }
        /// <summary>
        /// 版本
        /// </summary>
        [DataMember]
        public string Version { get; set; }
        /// <summary>
        /// 缩略图
        /// </summary>
        [DataMember]
        public string Thumbnail { get; set; }
        /// <summary>
        /// 描述
        /// </summary>
        [DataMember]
        public string Description { get; set; }
        /// <summary>
        /// Label宽度
        /// </summary>
        [DataMember]
        public int LabelWidth { get; set; }
        /// <summary>
        /// 小部件类型，普通部件：normal\条件部件：filter\指标部件：metrics
        /// </summary>
        [DataMember]
        public string PortletCategory { get; set; }
        /// <summary>
        /// 小部件是否单实例
        /// </summary>
        [DataMember]
        public bool PortletSingleInstance { get; set; }
        /// <summary>
        /// 界面适配模式
        /// </summary>
        [DataMember]
        public AdaptiveMode AdaptiveMode { get; set; }
        /// <summary>
        /// 界面样式表集合
        /// </summary>
        [DataMember]
        public StyleSheet StyleSheet { get; set; }
        /// <summary>
        /// Form
        /// </summary>
        [DataMember]
        public PageForm Form { get; set; }
        /// <summary>
        /// 模板ID
        /// </summary>
        [DataMember]
        public string TemplateID { get; set; }
        /// <summary>
        /// 主题ID
        /// </summary>
        [DataMember]
        public string ThemeID { get; set; }
        /// <summary>
        /// 主题
        /// </summary>
        [DataMember]
        public ThemeMetaData Theme { get; set; }
        /// <summary>
        /// 主题URL
        /// </summary>
        [DataMember]
        public string ThemeURL { get; set; }
        /// <summary>
        /// 默认主题URL
        /// </summary>
        [DataMember]
        public Dictionary<string,string> DefaultThemeURL { get; set; }
        /// <summary>
        /// BPOID
        /// </summary>
        [DataMember]
        public string BPOID { get; set; }
        ///// <summary>
        ///// 业务对象 Todo
        ///// </summary>
        //[DataMember]
        //public BizPermissionObject BPO { get; set; }
        /// <summary>
        /// 界面样式
        /// </summary>
        [DataMember]
        public PageCSS Style { get; set; }
        /// <summary>
        /// 状态机
        /// </summary>
        [DataMember]
        public List<PageStateMachine> PageStateMachines { get; set; } = new List<PageStateMachine>();
        /// <summary>
        /// 状态机
        /// </summary>
        [DataMember]
        public List<StateMachineMetadata> StateMachines { get; set; } = new List<StateMachineMetadata>();
        /// <summary>
        /// 用户组件用：响应式设置
        /// </summary>
        [DataMember]
        public Dictionary<string, string> ResponsiveGear { get; set; }
        ///// <summary>
        ///// 依赖元数据
        ///// </summary>
        //[DataMember]
        //public List<PageUIControlDependency> MetaDependencys { get; set; } = new List<PageUIControlDependency>();
        public object Clone()
        {
            return this.MemberwiseClone();
        }

        /// <summary>
        /// 弃用 主题
        /// </summary>
        [DataMember]
        public string ThemeCode { get; set; }
        /// <summary>
        /// 未用到 界面缓存配置
        /// </summary>
        [DataMember]
        public PageCache CacheConfig { get; set; }

        /// <summary>
        /// Page引类型：解释Explain\出码
        /// </summary>
        [DataMember]
        public EngineType EngineType { get; set; }

        /// <summary>
        /// 加载模式，0静态加载\1动态加载
        /// </summary>
        [DataMember]
        public int LoadMode { get; set; }
        /// <summary>
        /// 菜单所属功能组的ID
        /// </summary>
        [DataMember]
        public string GroupID { get; set; }
        /// <summary>
        /// 功能组名称
        /// </summary>
        [DataMember]
        public string GroupName { get; set; }
        /// <summary>
        ///  关键应用ID
        /// </summary>
        [DataMember]
        public string ApplicationID { get; set; }
        /// <summary>
        /// 模块ID
        /// 注意：当菜单同步为功能明细的时候，ModuleID是功能的ParentID。
        /// </summary>
        [DataMember]
        public string ModuleID { get; set; }
        /// <summary>
        /// 部门ID
        /// </summary>
        [DataMember]
        public string DepartmentID { get; set; }
        /// <summary>
        /// 重复请求优化，0\5秒\10秒\30秒\60秒
        /// </summary>
        [DataMember]
        public string PostLimit { get; set; }
        /// <summary>
        /// 最小占格数-小部件，1~4
        /// </summary>
        [DataMember]
        public int? MinCellCount { get; set; }

        /// <summary>
        /// 业务分类-指标组件
        /// </summary>
        [DataMember]
        public string BusinessType { get; set; }
    }
}
